package com.cdtye.itps.cms.service.defect;

import com.cdtye.common.mongocore.base.BaseService;
import com.cdtye.itps.cms.dao.detect.SysTaskDao;
import com.cdtye.itps.models.base.model.entity.repair.SysTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

/**
 * @Author: tian lei
 * @Date: 2019/9/23 14:53
 * @Description:
 */
@Service
public class SysTaskService extends BaseService<SysTask, String, SysTaskDao> {
    @Autowired
    private SysTaskDao sysTaskDao;

    public SysTask findByInfName(String infName) {
        Criteria criteria = new Criteria();
        criteria.and("infName").is(infName);
        return sysTaskDao.findOne(criteria);
    }

    /**
     * 根据接口名删除
     * @param infName
     */
    public void deleteByInfName(String infName) {
        Criteria criteria = new Criteria();
        criteria.and("infName").is(infName);
        sysTaskDao.delete(new Query(criteria));
    }
}
